//
//  UIView+sizeConvenient.m
//  Soolantra
//
//  Created by Bcc on 15/12/26.
//  Copyright © 2015年 eReach. All rights reserved.
//

#import "UIView+sizeConvenient.h"

@implementation UIView (sizeConvenient)

- (CGFloat)top
{
  return self.frame.origin.y;
}

- (CGFloat)left
{
  return self.frame.origin.x;
}

- (CGFloat)right
{
  return self.frame.origin.x + self.frame.size.width;
}

- (CGFloat)bottom
{
  return self.frame.origin.y + self.frame.size.height;
}

- (CGFloat)width
{
  return self.frame.size.width;
}

- (CGFloat)height
{
  return self.frame.size.height;
}

- (void)setLeft:(CGFloat)left
{
  CGRect frame = self.frame;
  CGRect newFrame = CGRectMake(left, frame.origin.y, frame.size.width, frame.size.height);
  self.frame = newFrame;
}



- (void)setTop:(CGFloat)top
{
  CGRect frame = self.frame;
  CGRect newFrame = CGRectMake(frame.origin.x, top, frame.size.width, frame.size.height);
  self.frame = newFrame;
}



- (void)setWidth:(CGFloat)width
{
    CGRect frame = self.frame;
    CGRect newFrame = CGRectMake(frame.origin.x, frame.origin.y, width, frame.size.height);
    self.frame = newFrame;
}



- (void)setHeight:(CGFloat)height
{
    CGRect frame = self.frame;
    CGRect newFrame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, height);
    self.frame = newFrame;
}


@end
